Ext.define('PJ.view.unitscompletionrate.List', {
    extend: 'AM.default.DefaultList',
    requires: ['AM.default.DefaultSearchForm',
               'AM.default.jsonp.DefaultLoadJsonp'//jsonp加载数据
               ],
   selModel: {
       selType: '',
       // 设置为只能通过复选框选中行
       checkOnly: true
   },
   isHavePage: false,
    initComponent: function(){
        var me = this;
        me.columns = [{
            header: '单位名称',
            dataIndex: 'signUnitName',
            flex: 1,
            minWidth: 110,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        }/*,{
            header: '计划总名额',
            dataIndex: 'planUserCount',
            width: 110,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        }*/,{
            header: '报名总人数',
            dataIndex: 'actualUserCount',
            width: 155,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        },{
            header: '参训完成率',
            dataIndex: 'complationRateStr',
            width: 110,
            renderer: function(value, meta, record){
            	meta.tdAttr = "data-qtip='" + value + "'";
            	return value;
            }
        }];
        me.store = Ext.create('PJ.' + prototype + '.unitscompletionrate.List', {
            isLoad: false
        });
        me.loadType = gj_onlineLearning_constant.loadType;
        me.callParent(arguments);
    },

    //导出
    onExportClick: function(){
    	var me = this;
        var store = me.getStore();
        var params=store.proxy.extraParams;
        var href=store.exportUrl + "?";
        for(var param in params){
        	if(params[param] === undefined){
        		href+="&"+param+"=";
        	}else{
        		href+="&"+param+"="+params[param];
        	}
        }
        href = encodeURI(href);
        var atag = Ext.get("exportResume");
        atag.set({
            "href": href
        });
        atag.dom.click();
    },
    listeners: {
        viewready: function(){
        	var me = this;
            this.addDocked([{
                dock: 'top',
                xtype: "searchform",
                columnCount: 2,
                fieldDefaults: {
                    labelAlign: 'right',
                    labelWidth: 80,
                    maxLength: 100
                },
                items: [{
                    xtype: "textfield",
                    fieldLabel: '单位名称',
                    name: "searchSignUnitName",
                    emptyText: "请输入单位名称"
                }],
                grid: this
            },{
                xtype: 'toolbar',
                dock: 'top',
                displayInfo: true,
                items: [{
                    text: '导出',
                    iconCls: 'deriveIco',
                    itemId: this.oldId + "Export",
                    disabled: false,
                    scope: this,
                    handler: this.onExportClick
                }, "->", "->", this.countSelectPanel]
            }]);
            // 触发权限过滤事件
            this.fireEvent("permission", this);
            var store = this.store;
            var params = store.proxy.extraParams;
            var newParams = {};
            Ext.apply(params, newParams);
            store.isLoad = true;
            store.load();
        },
        afterrender: function(){
            this.loadMask = new Ext.LoadMask(this, {
                msg: "正在加载中,请稍后...."
            });
        }
    }
});
